package com.lagou.service.impl;

import com.lagou.base.StatusCode;
import com.lagou.dao.CourseLessonDao;
import com.lagou.dao.impl.CourseLessonImpl;
import com.lagou.poji.Course_Lesson;
import com.lagou.service.CourseLessonService;
import com.lagou.utils.DateUtils;

public class CourseLessonServiceImpl implements CourseLessonService {
    CourseLessonDao courseLessonDao=new CourseLessonImpl();
    @Override
    public String saveLesson(Course_Lesson lesson) {
        lesson.setCreate_time(DateUtils.getDateFormart());
        lesson.setUpdate_time(DateUtils.getDateFormart());
        lesson.setIsDel(0);
        int i=courseLessonDao.saveLesson(lesson);

        if(i>0){
            String s = StatusCode.SUCCESS.toString();
            return s;


        }else {
            String s = StatusCode.FAIL.toString();
            return s;

        }
    }

    @Override
    public String updateLesson(Course_Lesson lesson) {
        lesson.setUpdate_time(DateUtils.getDateFormart());
        int i = courseLessonDao.updateLesson(lesson);   if(i>0){
            String s = StatusCode.SUCCESS.toString();
            return s;


        }else {
            String s = StatusCode.FAIL.toString();
            return s;

        }

    }
}
